In wireless communication represented by a wireless LAN complying with the IEEE802.11 standard series, an infrastructure mode in which an access point (base station) controls a network is defined. In recent years, there has been proposed a communication method in which a communication apparatus such as a mobile phone or digital camera incorporating a wireless LAN communication function serves as a base station to perform communication with another communication apparatus in the infrastructure mode (Japanese Patent Laid-Open No. 2009-225060). A communication apparatus serving as a base station has a DHCP Server function like a general wireless LAN access point apparatus (for example, Japanese Patent Laid-Open No. 2012-90205), and can assign IP addresses to communication apparatuses on the network using the DHCP protocol.
An example of a method of automatically discovering services provided by communication apparatuses on a local area network includes a discovery protocol such as UPnP (Universal Plug and Play). Applying the above-described communication method enables the communication apparatus serving as a base station to execute a search process using the discovery protocol after creating a network by itself, and to detect an opposite communication apparatus having a desired service.
When the communication apparatus serving as a base station executes a search process using the discovery protocol on the network created by itself, the timing of starting the search process becomes a problem. For UPnP, for example, upon start of the search process, the communication apparatus serving as a base station detects an opposite communication apparatus by multicasting a search message (SSDP M-Search) which requires a response from another communication apparatus having a desired service, and receiving a response to the message. Even if, however, the communication apparatus transmits a search message immediately after the network is created, the other communication apparatus has not joined the network yet and, therefore, the communication apparatus serving as a base station cannot receive a response to the search message, and cannot detect the opposite communication apparatus.
Conventionally, a base station never performs a service search, and a process of controlling other communication apparatuses to join the network and a search process using the discovery protocol do not cooperatively operate in the communication apparatus serving as a base station. Consequently, when a long time elapses after other communication apparatuses join the network, if the communication apparatus serving as a base station transmits a search message, it may take time for the communication apparatus serving as a base station to detect an opposite communication apparatus. As described above, the communication apparatus serving as a base station cannot execute a search process at an appropriate timing, thereby impairing the user convenience.